#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e4 + 5;

int n, m;
int head[N];
int ver[N << 1], Next[N << 1], tot;
void add(int u, int v) {
  ++tot;
  ver[tot] = v;
  Next[tot] = head[u];
  head[u] = tot;
}
int sz[N], mx[N];
void dfs_sz(int u, int fu) {
  sz[u] = 1;
  mx[u] = 0;
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (v == fu) continue;
    dfs_sz(v, u);
    mx[u] = max(mx[u], sz[v]);
    sz[u] += sz[v];
  }
}
void dfs(int u, int fu) {
  if (u != 1) mx[u] = max(mx[u], n - sz[u]);
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (v == fu) continue;
    dfs(v, u);
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 2, n) {
    int u, v;
    cin >> u >> v;
    add(u, v), add(v, u);
  }
  dfs_sz(1, 0);
  dfs(1, 0);
  int ans = *min_element(mx + 1, mx + n + 1);
  rep(i, 1, n) if (mx[i] == ans) cout << i << ' ';
  return 0;
}